#ifndef _RETRO_HEADER
#define _RETRO_HEADER

#define UNICODE
#define _UNICODE
#define _CRT_NON_CONFORMING_SWPRINTFS
#define _CRT_SECURE_NO_WARNINGS

#pragma comment(lib, "shlwapi.lib")

// includes
#include "..\..\sputilities\splib\splib.h"
#include "..\src\scintilla\Scintilla.h"
#include "..\src\scintilla\SciLexer.h"
#include <shlwapi.h>
#include <stdio.h>

// defines
#define INL     __forceinline
#define INLC    __forceinline const

// debug
#define HCHECK(x) if (FAILED(x)) return FALSE
#define FCHECK(x) if (!(x)) return FALSE

#if defined(DEBUG) || defined(_DEBUG)

#define DBG(debug, release) debug
#include <crtdbg.h>
#define ASSERT_MEMORY       ASSERT(_CrtCheckMemory())

#else

#define DBG(debug, release) release
#define ASSERT_MEMORY

#endif

#define SafeRelease(x) if (x) { x->Release(); x = NULL; }
#define SafeDelete(x) if (x) { delete x; x = NULL; }

#define Array_ForEach(var, items) \
    for (var = 0; var < sizeof(items) / sizeof(items[0]); ++var)
#define Array_ForEachI(var, items) \
    for (INT var = 0; var < sizeof(items) / sizeof(items[0]); ++var)
#define Array_ForEachL(var, items) \
    for (LONG var = 0; var < sizeof(items) / sizeof(items[0]); ++var)

#define Array_ForEachReverse(var, items) \
    for (var = sizeof(items) / sizeof(items[0]) - 1; var >= 0; --var)
#define Array_ForEachReverseI(var, items) \
    for (INT var = sizeof(items) / sizeof(items[0]) - 1; var >= 0; --var)
#define Array_ForEachReverseL(var, items) \
    for (LONG var = sizeof(items) / sizeof(items[0]) - 1; var >= 0; --var)

#define Array_FindIndex(var, value, items) \
    Array_ForEachReverse(var, items) { \
        if (items[var] == value) break; \
    }

#define ComboBox_AddStrings(combo, items) \
    Array_ForEachI(i, items) { \
        ComboBox_AddString(combo, items[0] +  \
            i * sizeof(items[0]) / sizeof(items[0][0])); \
    }

#define IsValidPath(path) (GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES)

using namespace SPLib;
using namespace SPLib::Layout;
using namespace SPLib::Windows;
using namespace SPLib::Controls;

#endif